package eco2automotive.data;
import java.util.ArrayList;
import java.io.*;
 /**  
  * This object contains a Parameter structure. 
  * This Structure is based on the StandarPIDs.xml file.
  * Structure of XML file:
 * 
  *</br>[param]
 * </br>[mode]01[/mode]
 * </br>[pid]10	[/pid]
 * </br>[bytes]	2	[/bytes]	
 * </br>[description]	MAF air flow rate	[/description]	
 * </br>[masc]	AABB	[/masc]	
 * </br>[min]	0	[/min]	
 * </br>[max]	655.35	[/max]	
 * </br>[units]	g/s	[/units]	
 * </br>[formula]	((A*256)+B) /100 [/formula]	
 * </br>[/param]
 * 
  * @version 1.0
  * @autor Fco. Javier Sánchez Esparza
 * @see eco2automotive.data.ValuePID
  *
  */ 

public class Parameter implements Serializable{
 private String mode;  
 private String PID; 
 private int bytesreturned;
 private String description;
ArrayList value_list = new ArrayList();

/** 
* Constructor
 * @param mode String of Operation Mode, ex: 01
 * @param pid String of Parameter id, ex: 00
 * @param bytesreturned number of bytes that is returned by de command mode+pid
 * @param description of the parameter
*/

public Parameter(String mode,String pid, int bytesreturned,String description){
this.mode=mode;
this.PID=pid;
this.bytesreturned=bytesreturned;
this.description=description;
}

/** 
*  This method insert a ValuePID(masc,min,max, units and formula values) to compose the Parameter 
 * @param v is a ValuePID to insert to the list
*/
public void addPID(ValuePID v){value_list.add(v);}
/** 
*  This method returns a ValuePID by position in the ArrayList 
 * @param pos is the position into de ArrayList
 * @return value_list instance of ValuePID
*/
public ValuePID getPID(int pos){return (ValuePID)value_list.get(pos);}
/** 
*  @return value_list.size()
*/
public int getNumberofPids(){ return this.value_list.size();}

/** 
*  set the mode
 * @param op String of mode
*/
public void setOperationMode(String op){this.mode=op;}
/** 
*  @return String that contains the operation mode
*/
public String getOperationMode(){return this.mode;}
/** 
*  @return String that contains the pid
*/
public String getPidKey(){return this.PID;}

/** 
*  @return String that contains the description of the Parameter
*/
public String getDescription(){return this.description;}
/** 
*  @return the number of bytes that is returned by de command mode+pid
*/
public int getBytesReturned(){return this.bytesreturned;}

}